//
//  MoreViews.swift
//  TomatoClock
//
//  Created by DaleGuo on 2023/11/21.
//

import SwiftUI
import SwiftUICharts

struct SettingViews: View {
    let myEmail = URL(string: "mailto:2877395242@qq.com")

    @EnvironmentObject var vm: HomeViewModel

    var body: some View {
        GeometryReader(content: { _ in
            NavigationStack {
                List {
                    introView
                }
                .listStyle(.grouped) // 结合Section一同产生效果
                .navigationTitle("Settings")
            }
        })
    }
}

#Preview {
    SettingViews()
        .environmentObject(HomeViewModel())
}

extension SettingViews {
    private var introView: some View {
        Section {
            VStack(alignment: .leading) {
                Image("Icon")
                    .resizable()
                    .frame(width: 100, height: 100)
                    .clipShape(RoundedRectangle(cornerRadius: 20))
                    .padding(.bottom)
                Text("This app was a cool & efficient timer to strong your learning time !")
                    .font(.callout)
                    .fontWeight(.medium)
                    .foregroundStyle(Color.accentColor)
            }
            .padding(.vertical)

            Link("Contact me ✉️ ", destination: myEmail!)

        } header: {
            Text("introduction")
        }
    }
}
